import request from "@/utils/request";
import { IQueryParams, ITableListItem } from "./data";

// 列表
export async function queryList(data?: IQueryParams): Promise<any> {
	return request({
		url: "/nutrition/admin/nutHelpArticle/pageList",
		method: "post",
		data,
	});
}

// 获取评论列表
export async function queryReviewList(params: { articleId: number; auditStatus: number }): Promise<any> {
	return request({
		url: "/nutrition/admin/nutComment/selectCommentByHelpArticle",
		method: "get",
		params,
	});
}

// 获取点赞列表
export async function queryLikeList(params: { articleId: number }): Promise<any> {
	return request({
		url: "/nutrition/admin/nutHelpArticle/nutHelpArticlePraiseList",
		method: "get",
		params,
	});
}

// 编辑
export async function editItem(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/nutHelpArticle",
		method: "put",
		data,
	});
}

// 文章审核
export async function articleReview(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/nutHelpArticle/auditNutHelpArticle",
		method: "post",
		data,
	});
}
// 评论编辑
export async function editReview(data: any): Promise<any> {
	return request({
		url: "/nutrition/admin/nutComment/updateComment",
		method: "put",
		data,
	});
}

// 评论审核
export async function review(data: any): Promise<any> {
	return request({
		url: "/nutrition/admin/nutComment/auditComment",
		method: "post",
		data,
	});
}
